/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package digital_ink;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
import com.sun.rave.web.ui.appbase.AbstractFragmentBean;
import com.sun.webui.jsf.component.Hyperlink;
import com.sun.webui.jsf.component.ImageComponent;
import com.sun.webui.jsf.component.Label;
import com.sun.webui.jsf.component.StaticText;
import java.io.Reader;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import javax.faces.FacesException;

/**
 * <p>Fragment bean that corresponds to a similarly named JSP page
 * fragment.  This class contains component definitions (and initialization
 * code) for all components that you have defined on this fragment, as well as
 * lifecycle methods and event handlers where you may add behavior
 * to respond to incoming events.</p>
 *
 * @version FragResultBusqueda.java
 * @version Created on 20-ene-2009, 22:26:11
 * @author Administrador
 */

public class FragResultBusqueda extends AbstractFragmentBean {
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">

    /**
     * <p>Automatically managed component initialization. <strong>WARNING:</strong>
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.</p>
     */
    private void _init() throws Exception {
    }
    String escrito1="";
    String escrito2="";
    String escrito3="";
    private StaticText staticText1 = new StaticText();

    public StaticText getStaticText1() {
        return staticText1;
    }

    public void setStaticText1(StaticText st) {
        this.staticText1 = st;
    }
    private StaticText staticText2 = new StaticText();

    public StaticText getStaticText2() {
        return staticText2;
    }

    public void setStaticText2(StaticText st) {
        this.staticText2 = st;
    }
    private StaticText staticText3 = new StaticText();

    public StaticText getStaticText3() {
        return staticText3;
    }

    public void setStaticText3(StaticText st) {
        this.staticText3 = st;
    }
    private Hyperlink leer1 = new Hyperlink();

    public Hyperlink getLeer1() {
        return leer1;
    }

    public void setLeer1(Hyperlink h) {
        this.leer1 = h;
    }
    private Hyperlink leer2 = new Hyperlink();

    public Hyperlink getLeer2() {
        return leer2;
    }

    public void setLeer2(Hyperlink h) {
        this.leer2 = h;
    }
    private StaticText staticText4 = new StaticText();

    public StaticText getStaticText4() {
        return staticText4;
    }

    public void setStaticText4(StaticText st) {
        this.staticText4 = st;
    }
    private StaticText staticText5 = new StaticText();

    public StaticText getStaticText5() {
        return staticText5;
    }

    public void setStaticText5(StaticText st) {
        this.staticText5 = st;
    }
    private StaticText staticText6 = new StaticText();

    public StaticText getStaticText6() {
        return staticText6;
    }

    public void setStaticText6(StaticText st) {
        this.staticText6 = st;
    }
    private Hyperlink leersem1 = new Hyperlink();

    public Hyperlink getLeersem1() {
        return leersem1;
    }

    public void setLeersem1(Hyperlink h) {
        this.leersem1 = h;
    }
    private StaticText staticText7 = new StaticText();

    public StaticText getStaticText7() {
        return staticText7;
    }

    public void setStaticText7(StaticText st) {
        this.staticText7 = st;
    }
    private StaticText staticText8 = new StaticText();

    public StaticText getStaticText8() {
        return staticText8;
    }

    public void setStaticText8(StaticText st) {
        this.staticText8 = st;
    }
    private StaticText staticText9 = new StaticText();

    public StaticText getStaticText9() {
        return staticText9;
    }

    public void setStaticText9(StaticText st) {
        this.staticText9 = st;
    }
    private StaticText staticTextTitulo = new StaticText();

    public StaticText getStaticTextTitulo() {
        return staticTextTitulo;
    }

    public void setStaticTextTitulo(StaticText st) {
        this.staticTextTitulo = st;
    }
    private StaticText staticTextEscrito = new StaticText();

    public StaticText getStaticTextEscrito() {
        return staticTextEscrito;
    }

    public void setStaticTextEscrito(StaticText st) {
        this.staticTextEscrito = st;
    }
    private ImageComponent image1 = new ImageComponent();

    public ImageComponent getImage1() {
        return image1;
    }

    public void setImage1(ImageComponent ic) {
        this.image1 = ic;
    }
    private StaticText staticTextAutor = new StaticText();

    public StaticText getStaticTextAutor() {
        return staticTextAutor;
    }

    public void setStaticTextAutor(StaticText st) {
        this.staticTextAutor = st;
    }
    private StaticText staticTextEscrito2 = new StaticText();

    public StaticText getStaticTextEscrito2() {
        return staticTextEscrito2;
    }

    public void setStaticTextEscrito2(StaticText st) {
        this.staticTextEscrito2 = st;
    }
    private StaticText staticTextTitulo2 = new StaticText();

    public StaticText getStaticTextTitulo2() {
        return staticTextTitulo2;
    }

    public void setStaticTextTitulo2(StaticText st) {
        this.staticTextTitulo2 = st;
    }
    private ImageComponent image2 = new ImageComponent();

    public ImageComponent getImage2() {
        return image2;
    }

    public void setImage2(ImageComponent ic) {
        this.image2 = ic;
    }
    private Hyperlink back1 = new Hyperlink();

    public Hyperlink getBack1() {
        return back1;
    }

    public void setBack1(Hyperlink h) {
        this.back1 = h;
    }
    // </editor-fold>

    public FragResultBusqueda() {
//staticText1.setVisible(true);
        //label1.setText(titulo.encontrado.getNombre());
//         for (Escrito e : titulo.encontrados) {
//               label1.setText(e.getNombre()+"/n/n"+ e.getResumen());
//             }

//        Iterator<Escrito> it =titulo.encontrados.iterator();
//        while(it.hasNext())
//        {
//          label1.setText(it.next().getNombre()+"/n/n"+ it.next().getResumen());
//        }
        
    }

    /**
     * <p>Callback method that is called whenever a page containing
     * this page fragment is navigated to, either directly via a URL,
     * or indirectly via page navigation.  Override this method to acquire
     * resources that will be needed for event handlers and lifecycle methods.</p>
     * 
     * <p>The default implementation does nothing.</p>
     */
    @Override
    public void init() {
        // Perform initializations inherited from our superclass
        super.init();
        // Perform application initialization that must complete
        // *before* managed components are initialized
        // TODO - add your own initialiation code here
        
        // <editor-fold defaultstate="collapsed" desc="Visual-Web-managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("Page1 Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
        }
        
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        // TODO - add your own initialization code here
       
    }

    /**
     * <p>Callback method that is called after rendering is completed for
     * this request, if <code>init()</code> was called.  Override this
     * method to release resources acquired in the <code>init()</code>
     * resources that will be needed for event handlers and lifecycle methods.</p>
     * 
     * <p>The default implementation does nothing.</p>
     */
    @Override
    public void destroy() {
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected RequestBean1 getRequestBean1() {
        return (RequestBean1) getBean("RequestBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected SessionBean1 getSessionBean1() {
        return (SessionBean1) getBean("SessionBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected ApplicationBean1 getApplicationBean1() {
        return (ApplicationBean1) getBean("ApplicationBean1");
    }

    public String leersem_action() {
            staticText1.setVisible(false);
            staticText2.setVisible(false);
            staticText3.setVisible(false);
            staticText4.setVisible(false);
            staticText5.setVisible(false);
            staticText6.setVisible(false);
            staticText7.setVisible(false);
            staticText8.setVisible(false);
            staticText9.setVisible(false);

            leer1.setVisible(false);
            leer2.setVisible(false);
            leersem1.setVisible(false);

            staticTextTitulo2.setVisible(true);
            staticTextEscrito2.setVisible(true);
            staticTextAutor.setVisible(true);

            image2.setVisible(true);
            back1.setVisible(true);
        
        return null;
    }

    public String leer2_action() {
        staticText1.setVisible(false);
        staticText2.setVisible(false);
        staticText3.setVisible(false);
        staticText4.setVisible(false);
        staticText5.setVisible(false);
        staticText6.setVisible(false);
        staticText7.setVisible(false);
        staticText8.setVisible(false);
        staticText9.setVisible(false);

        leer1.setVisible(false);
        leer2.setVisible(false);
        leersem1.setVisible(false);

        staticTextTitulo.setVisible(true);
        staticTextEscrito.setVisible(true);
        staticTextAutor.setVisible(true);

        image1.setVisible(true);
        back1.setVisible(true);
        return null;
    }

    public String leer1_action() {
        staticText1.setVisible(false);
        staticText2.setVisible(false);
        staticText3.setVisible(false);
        staticText4.setVisible(false);
        staticText5.setVisible(false);
        staticText6.setVisible(false);
        staticText7.setVisible(false);
        staticText8.setVisible(false);
        staticText9.setVisible(false);

        leer1.setVisible(false);
        leer2.setVisible(false);
        leersem1.setVisible(false);

        staticTextTitulo.setVisible(true);
        staticTextEscrito.setVisible(true);
        staticTextAutor.setVisible(true);

        image1.setVisible(true);
        back1.setVisible(true);
        return null;
    }

    public String back1_action() {
        staticText1.setVisible(true);
        staticText2.setVisible(true);
        staticText3.setVisible(true);
        staticText4.setVisible(true);
        staticText5.setVisible(true);
        staticText6.setVisible(true);
        staticText7.setVisible(true);
        staticText8.setVisible(true);
        staticText9.setVisible(true);

        leer1.setVisible(true);
        leer2.setVisible(true);
        leersem1.setVisible(true);

        staticTextTitulo2.setVisible(false);
        staticTextEscrito2.setVisible(false);
        staticTextAutor.setVisible(false);

        image2.setVisible(false);
        back1.setVisible(false);

        staticTextTitulo.setVisible(false);
        staticTextEscrito.setVisible(false);


        image1.setVisible(false);
       
        return null;
    }


}
